import { ipcRenderer } from "electron";
import { IConfirmCutImageParams } from "../types/cutImage.ts";

export const CutImagePreload = {
  //   截图
  openScreenShot: (type: "window" | "screen") => ipcRenderer.send("open_screen_shot", type),
  showScreenShot: () => ipcRenderer.send("show_screen_shot"),
  getScreenSouce: (fn: Function) => {
    ipcRenderer.on("get_screen_source", (_event, source) => fn(source));
  },
  confirmSceenShot: (data: string) => {
    ipcRenderer.send("confirm_screen_shot", data);
  },
  closeScreenShot: () => ipcRenderer.send("close_screen_shot"),
  getCutScreenResult: (fn: Function) => {
    ipcRenderer.on("cut_screen_result", (_event, data: IConfirmCutImageParams) => fn(data));
  },
  getScreenSize: () => {
    return {
      width: window.screen.width,
      height: window.screen.height,
    };
  },
};
